<div class="list">
<span class="txt"><a class="ajax" href="javascript:void(0);"></a></span>
    <table cellspacing="0" cellpadding="0" align="center">
	<tr class="th">
            <th>ID</th>	
            <th>连接名称</th>
            <th>连接网址</th>
            <th>连接图片</th>
            <th>排序ID</th>
            <th>操作</th>
	</tr>
    <?php foreach($links as $item):?>
	<tr class="bg">
            <td width="100"><?php echo $item['id'];?></td>
            <td width="200"><?php echo mb_substr($item['title'],0,10,'utf8');?></td>
            <td width="200"><?php echo mb_substr($item['url'],0,14,'utf8');?></td>
            <td width="100"></td>
            <td width="100"><?php echo $item['sortID'];?></td>
            <td class="odd" width="100">
			<a class="ajax2" id="<?php echo $item['id'];?>" href='javascript:void(0);'>编辑</a>|
                <a class='del' id="<?php echo $item['id'];?>" href='javascript:void(0);' >删除</a>
            </td>
	</tr>
    <?php endforeach;?>
	<tr>
            <td colspan="8" height="30"><?php echo $page;?></td>
	</tr>

    </table>
</div>

<script type="text/javascript">
$(document).ready(function(){
	$(".bg:odd").css("background-color","#EDEDED");
	$(".ajax").mouseover(function(){
        $(".ajax").wBox({requestType: "ajax",title:"添加友情链接",target:"<?php echo url('links/add')?>"});
    });
	$(".ajax2").mouseover(function(){
        id = $(this).attr('id');
        $(".ajax2").wBox({requestType: "ajax",title:"友情链接修改",target:"<?php echo url('links/edit?id=')?>"+id});
    });
	$(".del").click(function(){
		if(confirm("确认删除")){
			that = $(this);
			$.post("<?php echo url('links/del');?>",{id:that.attr('id')},function(data){
				if(data.s==1){
					that.parents('tr').remove();
				}else{
					alert(data.i);
				}
			});
		}
		return false;
		});	
});
</script>
